﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace FoundationLib.Ifc.Logging.Configuration
{
	/// <summary>
	/// This class represents a logger configuration.
	/// </summary>
	public class LoggerConfigElement : ConfigurationElement
	{
		/// <summary>
		/// Creates a new <see cref="LoggerConfigElement"/>.
		/// </summary>
		public LoggerConfigElement()
			: base()
		{
		}

		/// <summary>
		/// Gets the logger name.
		/// </summary>
		[ConfigurationProperty("name", IsRequired = true, IsKey = true)]
		public string Name
		{
			get
			{
				return (this["name"] as string);
			}
		}

		/// <summary>
		/// Gets an optional category used by the logger.
		/// </summary>
		[ConfigurationProperty("category", IsRequired = false)]
		public string Category
		{
			get
			{
				return (this["category"] as string);
			}
		}

		/// <summary>
		/// Gets a value indicating whether this logger configuration is the default logger for the given type.
		/// </summary>
		[ConfigurationProperty("isDefault", DefaultValue = false)]
		public bool IsDefault
		{
			get
			{
				return ((bool)this["isDefault"]);
			}
		}

		/// <summary>
		/// Gets the type of logger, which is either 'technical' or 'business'.
		/// </summary>
		[ConfigurationProperty("loggerType", DefaultValue = "technical", IsRequired = false)]
		public string LoggerType
		{
			get
			{
				return (this["loggerType"] as string);
			}
		}

		/// <summary>
		/// Gets the fully qualified class name implementing the logger interface.
		/// </summary>
		[ConfigurationProperty("implementation", IsRequired = true)]
		public string Implementation
		{
			get
			{
				return (this["implementation"] as string);
			}
		}
	}
}
